# -*- coding: utf-8 -*-
"""
automap
"""

import logging
from sqlalchemy.ext.automap import automap_base

from py_engine import engine, session

logger = logging.getLogger(__name__)

Base = automap_base()
Base.prepare(engine, reflect=True)


def test01():
    # DeclarativeMeta
    table = Base.classes.get('table_name')
    count = session.query(table).count()
    data = session.query(table).all()
    logger.info(f'count:{count}')
    pass


if __name__ == '__main__':
    test01()

    pass
